package club.xinghe.servlet.student;

import club.xinghe.biz.ExamBiz;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.Map;
//一整套题

@WebServlet("/student/StuExamServlet")
public class StuExamServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int eid= Integer.parseInt(request.getParameter("eid"));
        HttpSession session=request.getSession();
        session.setAttribute("eid",eid);//设置试卷的id为session类型
        ExamBiz examBiz=new ExamBiz();
        Map<String,Object> hashMap=examBiz.stuExamBiz(eid);
        request.setAttribute("map",hashMap);
        request.getRequestDispatcher("studentexam.jsp").forward(request,response);
    }
}
